package main

import (
    //"fmt"
	//"encoding/json"
	//"thirdpaysdk/api/qfpay"
	//"thirdpaysdk/api/megaezgo"
	"github.com/astaxie/beego"
	//"io/ioutil"
	"thirdpaysdk/api/yabandpay"
)

func main() {
    
	/*
	mchId := "99588586"
	secreCode := "pp_sRvxMcWYjjkyHNDnfsL14PQFY2D9sRtxzEpvbrdr5iSj5dHu"
	orderId := "20170201000023224"
	amount := "0.01"
	currency := "EUR"
	des := "YabandPay Pay Order"
	user := "info@yabandmedia.com"
	openId := "o7AXy5CG0NtL9zcrOmw0HeAO5MW0"
	appId := "wx54afe855ab7112e8"
	notifyUrl := "http://127.0.0.1/public/yabandpay/notify?merchant_id=%s"
	yabandpay.MicroAppPay(secreCode,orderId,amount,currency,des,user,openId,appId,notifyUrl)
	*/
	secreCode := "pp_sRvxMcWYjjkyHNDnfsL14PQFY2D9sRtxzEpvbrdr5iSj5dHu"
	notifyMsg := `{"sign":"6f5bcab2002be6043fc9aa2831406ec8681dda70a9eed3ada7e62268ab7c6bb8","data":{"amount":"0.10","createDate":"2019-03-28T14:33:42Z","currency":"EUR","description":"331268144188362752 & YabandPay P","nonce_string":"2POfwkk1D9oJQaIcZm","order_id":"331268144188362752","state":"paid","trade_id":"601d5a5b-f11e-e982-6183-c3f86a958a2e","transaction_id":"4200000307201903289668935155"}}`
	
	var response yabandpay.YaNotifyMsg
	err := yabandpay.ParseYabandNotify([]byte(notifyMsg), &response)
	if err != nil {
		beego.Debug("ParseYabandNotify:", err.Error())
		return
	}
	_, err = yabandpay.YabandNotify([]byte(notifyMsg),secreCode,response)
	if err != nil {
	    beego.Debug("YabandNotify:", err.Error())
		return
	}
	
}
